home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* ctdl.c */
- /* Command-interpreter code for Citadel */
- /************************************************************************/
-
- #include "ctdl.h"
-
- /************************************************************************/
- /* history */
- /* */
- /* 86Aug16 HAW Kill history for file because of space problems. */
- /* 84May18 JLS/HAW Greeting modified for coherency. */
- /* 84Apr04 HAW Upgrade to BDS 1.50a begun. */
- /* 83Mar08 CrT Aide-special functions installed & tested... */
- /* 83Feb24 CrT/SB Menus rearranged. */
- /* 82Dec06 CrT 2.00 release. */
- /* 82Nov05 CrT removed main() from room2.c and split into sub-fn()s */
- /************************************************************************/
-
- /************************************************************************/
- /* Contents */
- /* */
- /* doAide() handles Aide-only commands */
- /* doChat() handles C(hat) command */
- /* doEnter() handles E(nter) command */
- /* doForget() handles Z(Forget room) command */
- /* doGoto() handles G(oto) command */
- /* doHelp() handles H(elp) command */
- /* doKnown() handles K(nown rooms) command */
- /* doLogin() handles L(ogin) command */
- /* doLogout() handles T(erminate) command */
- /* doRead() handles R(ead) command */
- /* doRegular() fanout for above commands */
- /* doSkip() handles S(kip) command */
- /* doSysop() handles sysop-only commands */
- /* doUngoto() handles U(ngoto) command */
- /* getCommand() prints prompt and gets command char */
- /* greeting() System-entry blurb etc */
- /* main() has the central menu code */
- /************************************************************************/
-
- /************************************************************************/
- /* External declarations in CTDL.C */
- /************************************************************************/
- char ExitToMsdos = FALSE; /* True when time to bring system down */
- int exitValue = CRASH_EXIT;
-
- char *confirm = "confirm";
- char *NoDownloads = "\n Sorry, this room does not allow downloads\n";
-
- /************************************************************************/
- /* External variable definitions for CTDL.C */
- /************************************************************************/
- extern struct config cfg; /* The main variable to be saved */
- extern struct aRoom roomBuf; /* Room buffer */
- extern struct msgB msgBuf; /* Message buffer */
- extern struct msgB tempMess; /* Message buffer */
- extern struct logBuffer logBuf; /* Person's log buffer */
- extern struct rTable roomTab[]; /* Room index for RAM */
- extern struct lTable *logTab; /* Log index for RAM */
- extern long FDSectCount; /* size of files in directory */
- extern int thisRoom; /* Current room */
- extern long int pulledMLoc; /* Loc of msg to be pulled */
- extern ulong pulledMId; /* Id of msg to be pulled */
- extern char noBanner;
- extern FILE *bannerFile;
- extern char *who_str;
- extern char remoteSysop;
- extern char onConsole; /* Where IO is ... */
- extern char whichIO; /* Where IO is ... */
- extern char outFlag;
- extern char expert; /* User expert? */
- extern char aide; /* User aide? */
- extern char loggedIn; /* Are we logged in? */
- extern char echo;
- extern char newCarrier; /* Just got carrier, hurrah! */
- extern char justLostCarrier;/* Boo, hiss! */
- extern char usingWCprotocol;/* WC protocol flag */
- extern char textDownload; /* flag */
- extern char haveCarrier;
- extern char *baseRoom;
- extern int lastRoom; /* For Ungoto command */
- extern char heldMess;
- extern char anyEcho;
-
- extern int acount;
- #define AUDIT 9000
- extern char audit[AUDIT];
-
- /************************************************************************/
- /* External function definitions for CTDL.C */
- /************************************************************************/
- char toUpper();
- char iChar();
- long getNumber();
-
- /************************************************************************/
- /* doAide() handles the aide-only menu */
- /* return FALSE to fall invisibly into default error msg */
- /************************************************************************/
- char doAide(moreYet, first)
- char moreYet;
- char first; /* first parameter if TRUE */
- {
- label oldName;
- int rm, roomExist();
- char chatStack;
-
- if (!aide) return FALSE;
-
- if (moreYet) first = '\0';
-
- mPrintf("ide special fn: ");
-
- if (first) oChar(first);
-
- switch (toUpper( first ? first : iChar() )) {
- case 'C':
- chatStack = cfg.noChat;
- cfg.noChat = FALSE;
- mPrintf("hat\n ");
- if (whichIO == MODEM) ringSysop();
- else interact() ;
- cfg.noChat = chatStack;
- break;
- case 'D':
- sPrintf(msgBuf.mbtext, "The following empty rooms deleted by %s: ",
- logBuf.lbname);
- mPrintf("elete empty rooms\n ");
- if (!getYesNo(confirm))
- break;
- strCpy(oldName, roomBuf.rbname);
- indexRooms();
-
- if ((rm=roomExist(oldName)) != ERROR) getRoom(rm);
- else getRoom(LOBBY);
-
- aideMessage( /* noteDeletedMessage== */ FALSE );
- break;
- case 'E':
- mPrintf("dit room\n \n");
- renameRoom();
- break;
- case 'I':
- mPrintf("nsert message\n ");
- if (
- thisRoom == AIDEROOM
- ||
- pulledMId == 0l
- ) {
- mPrintf("nope!");
- break;
- }
- if (!getYesNo(confirm))
- break;
- note2Message(pulledMId, pulledMLoc);
- putRoom(thisRoom);
- noteRoom();
- sPrintf(
- msgBuf.mbtext,
- "Following message inserted in %s> by %s",
- roomBuf.rbname,
- logBuf.lbname
- );
- aideMessage( /* noteDeletedMessage == */ TRUE);
- break;
- case 'K':
- mPrintf("ill room\n ");
- if (
- thisRoom == LOBBY
- ||
- thisRoom == MAILROOM
- ||
- thisRoom == AIDEROOM
- ) {
- mPrintf(" not here!");
- break;
- }
- if (!getYesNo(confirm)) break;
-
- sPrintf(
- msgBuf.mbtext,
- "%s> killed by %s",
- roomBuf.rbname,
- logBuf.lbname
- );
- aideMessage( /* noteDeletedMessage == */ FALSE);
-
- roomBuf.rbflags.INUSE = FALSE;
- putRoom(thisRoom);
- noteRoom();
- getRoom(LOBBY);
- break;
- case 'S':
- mPrintf("et Date\n ");
- changeDate();
- break;
- case '?':
- tutorial("aide.mnu");
- break;
- default:
- if (!expert) mPrintf(" ?(Type '?' for menu)\n " );
- else mPrintf(" ?\n " );
- break;
- }
- return TRUE;
- }
-
- /************************************************************************/
- /* doChat() */
- /************************************************************************/
- doChat(moreYet, first)
- char moreYet; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- if (moreYet) first = '\0';
-
- if (first) oChar(first);
-
- mPrintf("hat ");
-
- if (whichIO != MODEM) {
- interact() ;
- return ;
- }
-
- if (cfg.noChat) {
- tutorial("nochat.blb");
- return;
- }
-
- ringSysop();
- }
-
- /************************************************************************/
- /* doEnter() handles E(nter) command */
- /************************************************************************/
- doEnter(moreYet, first)
- char moreYet; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- #define CONFIGURATION 0
- #define MESSAGE 1
- #define PASSWORD 2
- #define ROOM 3
- #define ENTERFILE 4
- #define CONTINUED 5
- #define NETWORK 6
-
- #define NOPE 0
- #define GIVEMENU 1
- #define NOMENU 2
- char what; /* one of above seven */
- char abort, done, WC;
- char letter;
-
- if (moreYet) first = '\0';
-
- abort = NOPE ;
- done = FALSE ;
- WC = FALSE ;
- what = MESSAGE;
-
- mPrintf("nter ");
-
- if (thisRoom != MAILROOM && !loggedIn && !cfg.unlogEnterOk) {
- mPrintf("Must log in to enter messages except MAIL to the SYSOP\n ");
- return FALSE;
- }
-
- if (first) oChar(first);
-
- do {
- outFlag = OUTOK;
-
- letter = (toUpper( first ? first : iChar() ));
- switch (letter) {
- case '\r':
- case '\n':
- moreYet = FALSE;
- break;
- case 'X':
- case 'W':
- mPrintf("%s protocol ", (letter == 'W') ? "C" : "modem");
- WC = TRUE;
- break;
- case 'F':
- if (roomBuf.rbflags.MSDOSDIR == 1) {
- mPrintf("ile upload ");
- if ((abort = ((!loggedIn) ? NOMENU : NOPE)) == NOMENU)
- mPrintf("\n Must be logged in!\n ");
- else if ((abort = ((!roomBuf.rbflags.UPLOAD)
- ? NOMENU : NOPE)) == NOMENU)
- mPrintf("\n Sorry, this room is not available for upload.\n ");
- what = ENTERFILE;
- done = TRUE;
- break;
- }
- default:
- abort = GIVEMENU;
- break;
- case 'C':
- if (WC)
- abort = GIVEMENU;
- else {
- mPrintf("onfiguration ");
- what = CONFIGURATION;
- done = TRUE;
- }
- break;
- case 'M':
- mPrintf("essage " );
- what = MESSAGE;
- done = TRUE;
- break;
- case 'P':
- if (WC)
- abort = GIVEMENU;
- else {
- mPrintf("assword " );
- what = PASSWORD ;
- done = TRUE;
- }
- break;
- case 'R':
- if (WC)
- abort = GIVEMENU;
- else {
- mPrintf("oom " );
- if (!cfg.nonAideRoomOk && !aide) {
- mPrintf(" ?-- must be aide to create room\n ");
- abort = NOMENU;
- break;
- }
- if (!loggedIn) {
- mPrintf("!Must log in to create a new room\n");
- abort = NOMENU;
- break;
- }
- what = ROOM;
- done = TRUE;
- }
- break;
- case 'H':
- if (WC)
- abort = GIVEMENU;
- else {
- mPrintf("eld Message ");
- what = CONTINUED;
- done = TRUE;
- }
- break;
- case 'N':
- mPrintf("et-Message ");
- what = NETWORK;
- done = TRUE;
- break;
- }
- first = '\0';
- if (abort != NOPE) {
- mPrintf("? ");
- if (abort == GIVEMENU && (!expert || letter == '?'))
- tutorial("entopt.mnu");
- }
- } while (!done && moreYet && abort == NOPE);
-
- doCR();
-
- if (abort == NOPE) {
- if (whichIO != CONSOLE && thisRoom == MAILROOM) echo = CALLER;
- switch (what) {
- case CONFIGURATION : configure(loggedIn); break;
- case MESSAGE : makeMessage(WC) ; break;
- case PASSWORD : newPW() ; break;
- case ROOM : makeRoom() ; break;
- case ENTERFILE : upLoad() ; break;
- case CONTINUED : hldMessage() ; break;
- case NETWORK : netMessage(WC) ; break;
- }
- echo = BOTH;
- }
- }
-
- /************************************************************************/
- /* doForget() handles (Forget room) command */
- /************************************************************************/
- doForget(expand, first)
- char expand, first;
- {
- int i;
-
- if (!expand) {
- mPrintf("\bForget %s \n ", roomBuf.rbname);
- if (thisRoom == LOBBY ||
- thisRoom == MAILROOM ||
- thisRoom == AIDEROOM) {
- mPrintf("!Can't forget this room! \n ");
- return ;
- }
- if (!getYesNo(confirm)) return;
- i = (roomBuf.rbgen + FORGET_OFFSET) % MAXGEN; /* Set up offset*/
- logBuf.lbgen[thisRoom] = i << GENSHIFT; /* Save it */
- gotoRoom(baseRoom, 'S');
- }
- else {
- mPrintf("\b\b ");
- listRooms(FGTRMS);
- }
- }
-
- /************************************************************************/
- /* doGoto() handles G(oto) command */
- /************************************************************************/
- doGoto(expand, first)
- char expand; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- label roomName;
-
- outFlag = IMPERVIOUS;
- mPrintf("oto ");
-
- if (!expand) {
- gotoRoom("", 'R');
- return;
- }
-
- getNormStr("", roomName, NAMESIZE, ECHO);
-
- if (roomName[0] == '?') {
- listRooms(LINNEW);
- listRooms(NOROLD);
- }
- else
- gotoRoom(roomName, 'R');
- }
-
- /************************************************************************/
- /* doHelp() handles H(elp) command */
- /************************************************************************/
- doHelp(expand, first)
- char expand; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- label fileName;
-
- mPrintf("elp ");
- if (!expand) {
- mPrintf("\n\n");
- tutorial("dohelp.hlp");
- return;
- }
-
- getNormStr("", fileName, 9, ECHO);
- if (strLen(fileName) == 0)
- strCpy(fileName, "dohelp");
- if (fileName[0] == '?') tutorial("helpopt.hlp");
- else {
- /* adding the extention makes things look simpler for */
- /* the user... and restricts the files which can be read */
- strCat(fileName, ".hlp");
- tutorial(fileName);
- }
- }
-
- /************************************************************************/
- /* doKnown() handles K(nown rooms) command. */
- /************************************************************************/
- doKnown(expand, first)
- char expand; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- mPrintf("nown rooms ");
- if (!expand) {
- mPrintf("\n ");
- listRooms(LINNEW);
- listRooms(NOROLD);
- }
- else
- searchRooms();
- }
-
- /************************************************************************/
- /* doLogin() handles L(ogin) command */
- /************************************************************************/
- doLogin(moreYet, first)
- char moreYet; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- label passWord;
-
- mPrintf("ogin ");
- if (!moreYet) mPrintf("\n");
- if (loggedIn) {
- mPrintf("\n ?Already logged in!\n ");
- return;
- }
- echo = CALLER;
- getNormStr(moreYet ? "" : " password (just carriage return if new)",
- passWord, NAMESIZE, (moreYet) ? ECHO : NO_ECHO);
- echo = BOTH;
- login(passWord);
- }
-
- /************************************************************************/
- /* doLogout() handles T(erminate) command */
- /************************************************************************/
- doLogout(expand, first)
- char expand; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
-
- if (expand) first = '\0';
-
- mPrintf("erminate ");
-
- if (heldMess)
- mPrintf("\n WARNING: You have a message in your Hold Message Buffer!\n ");
-
- if (first) oChar(first);
-
- switch (toUpper( first ? first : iChar() )) {
- case '?':
- mPrintf("\n Logout options:\n \n ");
-
- mPrintf("Quit-also\n " );
- mPrintf("Stay\n " );
- break;
- case 'Q':
- mPrintf("uit-also\n ");
- if (!expand) {
- if (!getYesNo(confirm)) break;
- }
- if (!onLine()) break;
- terminate( /* hangUp == */ TRUE);
- break;
- case 'S':
- mPrintf("tay\n ");
- terminate( /* hangUp == */ FALSE);
- break;
- }
- }
-
- /************************************************************************/
- /* doRead() handles R(ead) command */
- /************************************************************************/
- doRead(moreYet, first)
- char moreYet; /* TRUE to accept following parameters */
- char first; /* first parameter if TRUE */
- {
- int fDir(), transmitFile(), tutorial();
- long sectors, bytes;
- char abort, doDir, done, hostFile, whichMess, revOrder, status, WC;
- char letter;
- char formatted;
- label fileName;
-
-
- if (moreYet) first = '\0';
-
- mPrintf("\bread ");
-
- abort = FALSE;
- doDir = FALSE;
- hostFile = FALSE;
- revOrder = FALSE;
- status = FALSE;
- WC = WC_NONE;
- formatted = FALSE;
- whichMess = NEWoNLY;
-
- if (thisRoom == MAILROOM && !loggedIn && !cfg.unlogReadOk) {
- showMessages(whichMess, revOrder);
- return;
- }
-
- if (!loggedIn && !cfg.unlogReadOk) {
- mPrintf("Must log in to read\n ");
- return;
- }
-
- if (first) oChar(first);
-
- do {
- outFlag = OUTOK;
- done = TRUE;
-
- letter = toUpper(first ? first : iChar());
- switch (letter) {
- case '\n':
- case '\r':
- moreYet = FALSE;
- break;
- case 'A':
- if (hostFile) break;
- mPrintf("ll");
- whichMess = OLDaNDnEW;
- break;
- case 'F':
- if (!hostFile) {
- mPrintf("orward");
- revOrder = FALSE;
- whichMess = OLDaNDnEW;
- }
- else {
- mPrintf("ormatted");
- formatted = TRUE;
- }
- break;
- case 'G':
- if (hostFile) break;
- mPrintf("lobal new-messages");
- whichMess = GLOBALnEW;
- break;
- case 'N':
- if (hostFile) break;
- mPrintf("ew ");
- whichMess = NEWoNLY;
- break;
- case 'O':
- if (hostFile) break;
- mPrintf("ld Reverse");
- revOrder = TRUE;
- whichMess = OLDoNLY;
- break;
- case 'R':
- if (hostFile) break;
- mPrintf("everse");
- revOrder = TRUE;
- whichMess = OLDaNDnEW;
- break;
- case 'S':
- if (hostFile) break;
- mPrintf("tatus\n ");
- status = TRUE;
- break;
- case 'X':
- case 'W':
- if (hostFile) break;
- mPrintf("%s protocol ", (letter == 'W') ? "C" : "modem");
- WC = (letter == 'W') ? WC_NETWORK : WC_NORMAL;
- done = FALSE;
- break;
- case 'B':
- if (hostFile) break;
- if (roomBuf.rbflags.MSDOSDIR == 1 && loggedIn) {
- mPrintf("inary file(s) ");
- if (roomBuf.rbflags.DOWNLOAD == 1 || TheSysop() ||
- remoteSysop) {
- hostFile = TRUE ;
- textDownload = FALSE;
- break;
- }
- else {
- mPrintf(NoDownloads);
- abort = TRUE;
- break;
- }
- }
- case 'D':
- if (hostFile) break;
- if (roomBuf.rbflags.MSDOSDIR == 1) {
- mPrintf("irectory ");
- if (roomBuf.rbflags.DOWNLOAD || TheSysop() || remoteSysop) {
- doDir = TRUE;
- break;
- }
- else {
- mPrintf(NoDownloads);
- abort = TRUE;
- break;
- }
- }
- case 'T':
- if (hostFile) break;
- if (roomBuf.rbflags.MSDOSDIR == 1 && loggedIn) {
- mPrintf("extfile(s) ");
- if (roomBuf.rbflags.DOWNLOAD || TheSysop() || remoteSysop) {
- hostFile = TRUE;
- textDownload = TRUE;
- if (WC == WC_NONE) done = FALSE;
- break;
- }
- else {
- mPrintf(NoDownloads);
- abort = TRUE;
- break;
- }
- }
- default:
- mPrintf("? ");
- abort = TRUE;
- setUp(FALSE);
- if (expert) break;
- case '?':
- tutorial("readopt.mnu");
- abort = TRUE;
- break;
- }
- first = '\0';
- } while (!done && moreYet && !abort);
-
- if (abort) return;
-
- if (status) {
- systat();
- return;
- }
-
- if (doDir) {
- FDSectCount = 0; /* global fDir() totals sectors in */
- getNormStr("", fileName, NAMESIZE, ECHO);
-
- if (strLen(fileName)) wildCard(fDir, fileName);
- else wildCard(fDir, "*.*" );
-
- mPrintf("\n Approximately %ld sectors total\n ", FDSectCount);
- diskSpaceLeft(roomBuf.rbdisk + 'A', §ors, &bytes);
- printf("\nThere are %ld bytes left on drive %c:\n", bytes,
- roomBuf.rbdisk + 'A');
- return;
- }
-
- if (hostFile) {
- getNormStr("afn", fileName, NAMESIZE, ECHO);
- usingWCprotocol = WC;
- wildCard((formatted) ? tutorial : transmitFile, fileName);
- usingWCprotocol = WC_NONE;
- return;
- }
-
- doCR();
- #ifdef OLD_STYLE
- if (WC != WC_NONE) {
- download(whichMess, revOrder, WC);
- return;
- }
-
- if (whichMess != GLOBALnEW) {
- showMessages(whichMess, revOrder);
- } else {
- while (outFlag != OUTSKIP && gotoRoom("", 'R')) {
- givePrompt();
- mPrintf("read new\n ");
- showMessages(NEWoNLY, revOrder);
- }
- }
- #else
- if (WC != WC_NONE) {
- download(whichMess, revOrder, WC);
- return;
- }
-
- if (whichMess != GLOBALnEW) {
- showMessages(whichMess, revOrder);
- } else {
- doGlobal(revOrder);
- }
- #endif
- }
-
- #define MAX_USER_ERRORS 25
- /************************************************************************/
- /* doRegular() */
- /************************************************************************/
- char doRegular(x, c)
- char x, c;
- {
- static int errorCount = 0;
- char toReturn, *strchr();
-
- toReturn = FALSE;
-
- if (strchr("CEFGHKLNORSTU?", toUpper(c)) != NULL) errorCount = 0;
- else errorCount++;
-
- switch (c) {
-
- case 'C': doChat( x, '\0'); break;
- case 'E': doEnter( x, 'm' ); break;
- case 'F': doRead( x, 'f' ); break;
- case 'G': doGoto( x, '\0'); break;
- case 'H': doHelp( x, '\0'); break;
- case 'K': doKnown( x, '\0'); break;
- case 'L': doLogin( x, '\0'); break;
- case 'N': doRead( x, 'n' ); break;
- case 'O': doRead( x, 'o' ); break;
- case 'R': doRead( x, 'r' ); break;
- case 'S': doSkip( x, '\0'); break;
- case 'T': doLogout(x, 'q' ); break;
- case 'U': doUngoto(x, '\0'); break;
-
- case 0:
- if (newCarrier) {
- greeting();
- newCarrier = FALSE;
- }
- if (justLostCarrier) {
- justLostCarrier = FALSE;
- if (loggedIn) terminate(FALSE);
- }
- break; /* irrelevant value */
- case '?':
- tutorial("mainopt.mnu");
- if (whichIO == CONSOLE) mPrintf("\n^l: SysOp privileged fns\n ");
- break;
-
- case 'A': if (!doAide(x, 'E')) toReturn=TRUE; break;
- case 'Z': doForget(x, '\0'); break;
- default:
- if (errorCount > MAX_USER_ERRORS) {
- logMessage(EVIL_SIGNAL, "", 'E');
- interpret(cfg.pHangUp);
- }
- toReturn=TRUE;
- break;
- }
- return toReturn;
- }
-
- /************************************************************************/
- /* doSkip() handles the <S>kip a room command */
- /************************************************************************/
- doSkip(expand, first)
- char first, expand;
- {
- label roomName; /* In case of ".Skip" */
-
- outFlag = IMPERVIOUS;
- mPrintf("kip %s> goto ", roomTab[thisRoom].rtname);
- if (expand)
- getNormStr("", roomName, NAMESIZE, ECHO);
- else
- roomName[0] = '\0';
- if (roomName[0] == '?')
- tutorial("skip.hlp");
- else {
- roomTab[thisRoom].rtflags.SKIP = 1; /* Set bit */
- gotoRoom(roomName, 'S');
- }
- }
-
- /************************************************************************/
- /* doSysop() handles the sysop-only menu */
- /* return FALSE to fall invisibly into default error msg */
- /************************************************************************/
- char doSysop(c, first)
- char c;
- char first; /* first parameter if TRUE */
- {
- ulong temp;
- char systemPW[200];
- extern char *VERSION;
- extern char *netVersion;
- extern int fixVers, majorVers;
- label who;
- struct logBuffer lBuf;
- int logNo, ltabSlot;
-
- if (!onConsole) {
- if (!aide || strLen(cfg.sysPassword) == 0)
- return TRUE;
- echo = CALLER;
- getNormStr("password", systemPW, 199, NO_ECHO);
- echo = BOTH;
- if (strCmp(systemPW, cfg.sysPassword) != 0)
- return TRUE;
- remoteSysop = TRUE;
- }
-
- while (onLine()) {
-
- outFlag = OUTOK;
- mPrintf("\n privileged fn: ");
-
- switch (toUpper( first ? first : iChar() )) {
- case 'Z':
- mPeek(); break;
- case 'B':
- interpret(cfg.pBauds[(int) getNumber(" baud (0-3)", 0l, 3l)]);
- break;
- case 'E':
- mPrintf("cho %sabled\n ", (anyEcho = !anyEcho) ? "en" : "dis");
- break;
- case 'F':
- mPrintf("ile grab\n ");
- ingestFile();
- break;
- case 'A':
- mPrintf("bort\n ");
- return FALSE;
- case 'C':
- mPrintf("hat mode %sabled\n ",
- (cfg.noChat = !cfg.noChat)
- ?
- "dis"
- :
- "en"
- );
- break;
- case 'D':
- cfg.debug = !cfg.debug;
- mPrintf("ebug switch=%d\n \n", cfg.debug);
- break;
- case 'I':
- mPrintf("nformation\n ");
- mPrintf("Citadel-86 V%s\n Net version %s", VERSION, netVersion);
- mPrintf("\n Commands version %d.%d\n ", majorVers, fixVers);
- mPrintf("ctdlcnfg.sys version %d\n ", cfg.paramVers);
- break;
- case 'K':
- mPrintf("ill account\n ");
- getNormStr(who_str, who, NAMESIZE, ECHO);
- logNo = findPerson(who, &lBuf);
- if (logNo == ERROR) {
- mPrintf("No such person\n ");
- break;
- }
- if (lBuf.credit != 0)
- mPrintf("%s has %d credit for l-d!", who);
- if (!getYesNo(confirm)) break;
- mPrintf("%s deleted\n ", who);
- ltabSlot = PWSlot(lBuf.lbpw, /* load == */ FALSE);
- lBuf.lbname[0] = '\0';
- lBuf.lbpw[0 ] = '\0';
- lBuf.lbflags.L_INUSE = FALSE;
-
- putLog(&lBuf, logNo);
-
- logTab[ltabSlot].ltpwhash = 0;
- logTab[ltabSlot].ltnmhash = 0;
-
- break;
- case 'M':
- mPrintf("\bSystem now on MODEM\n ");
- /* if (!remoteSysop) { */
- if (whichIO != MODEM) {
- whichIO = MODEM;
- setUp(FALSE);
- }
- mPrintf("Chat mode %sabled\n ", cfg.noChat ? "dis" : "en");
- if (cfg.debug) mPrintf("Debug mode on\n " );
- #ifdef NEED_VISIBLE
- if (visibleMode) mPrintf("Visible mode on\n ");
- #endif
- return FALSE;
- case 'O':
- mPrintf("ther Commands\n ");
- systemCommands();
- break;
- case 'P':
- mPrintf("\baide privilege set/clear\n ");
- getNormStr(who_str, who, NAMESIZE, ECHO);
- logNo = findPerson(who, &lBuf);
- if (logNo == ERROR) {
- mPrintf("No such person\n ");
- break;
- }
-
- if (lBuf.lbflags.AIDE == 1)
- lBuf.lbflags.AIDE = 0;
- else
- lBuf.lbflags.AIDE = 1;
- mPrintf(
- "%s %s aide privileges\n ",
- who,
- (lBuf.lbflags.AIDE == 1) ? "gets" : "loses"
- );
- if (!getYesNo(confirm)) break;
-
- putLog(&lBuf, logNo);
-
- /* see if it is us: */
- if (loggedIn && strCmpU(logBuf.lbname, who)==SAMESTRING) {
- aide = (lBuf.lbflags.AIDE == 1) ? TRUE : FALSE;
- logBuf.lbflags.AIDE = (aide) ? TRUE : FALSE;
- }
- break;
- case 'S':
- changeDate();
- break;
- #ifdef NEED_VISIBLE
- case 'V':
- mPrintf(" VisibleMode==%d\n ", visibleMode = !visibleMode);
- break;
- #endif
- case 'X':
- mPrintf("\bexit to MS-DOS\n \n");
- if (!getYesNo(confirm)) break;
- ExitToMsdos = TRUE;
- exitValue = (remoteSysop) ? REMOTE_SYSOP_EXIT : SYSOP_EXIT;
- return FALSE;
- case 'N':
- netStuff();
- break;
- case 'R':
- mPrintf("einitialize Modem\n ");
- modemInit();
- break;
- case 'Q':
- temp = getNumber(" Set oldest to", 0l, 200000l);
- if (temp != 0l) cfg.oldest = temp;
- break;
- case '?':
- tutorial("ctdlopt.mnu");
- break;
- default:
- if (!expert) mPrintf(" ?(Type '?' for menu)\n " );
- else mPrintf(" ?\n " );
- break;
- }
- }
- }
-
- /************************************************************************/
- /* doUngoto() handles the Ungoto command */
- /************************************************************************/
- doUngoto(moreYet, first)
- char moreYet;
- char first; /* first parameter if TRUE */
- {
- label target;
-
- mPrintf("ngoto ");
- if (!moreYet) {
- doCR();
- strCpy(target, "");
- }
- else {
- getNormStr("", target, NAMESIZE, ECHO);
- }
- retRoom(target);
- }
-
- /************************************************************************/
- /* getCommand() prints menu prompt and gets command char */
- /* Returns: char via parameter and expand flag as value -- */
- /* i.e., TRUE if parameters follow else FALSE. */
- /************************************************************************/
- char getCommand(c)
- char *c;
- {
- char BBSCharReady();
- char expand;
-
- outFlag = OUTOK;
-
- givePrompt();
-
- *c = toUpper(iChar());
-
- expand = (
- *c == ' '
- ||
- *c == '.'
- ||
- *c == ','
- ||
- *c == '/'
- );
- if (expand) *c = toUpper(iChar());
-
- if (justLostCarrier) {
- justLostCarrier = FALSE;
- if (loggedIn) terminate(FALSE);
- }
- return expand;
- }
-
- /************************************************************************/
- /* greeting() gives system-entry blurb etc */
- /************************************************************************/
- greeting()
- {
- extern char *VERSION;
-
- if (loggedIn) terminate(FALSE);
-
- setUp(TRUE); pause(10);
-
- setmem(audit, AUDIT, ' ');
- acount = 0;
-
- doCR();
- if (noBanner)
- mPrintf("Welcome to %s\n", cfg.codeBuf + cfg.nodeTitle);
- else
- writeTutorial(bannerFile, FALSE);
- mPrintf(" Running: Citadel-86 (V%s) \n \n", VERSION);
- printDate();
- mPrintf("\n H for Help\n ");
-
- printf("Chat mode %sabled\n", cfg.noChat ? "dis" : "en");
- printf("\n 'MODEM' mode.\n " );
- printf("(<ESC> for CONSOLE mode.)\n " );
- while (MIReady())
- inp();
-
- gotoRoom(baseRoom, 'R');
- lastRoom = -1;
- }
-
- /************************************************************************/
- /* main() contains the central menu code */
- /************************************************************************/
- main(argc, argv)
- int argc;
- char **argv;
- {
- extern char logNetResults, IBMinterrupts;
- char c, x;
- char errMsg;
- char getCommand();
-
- cfg.weAre = CITADEL;
- errMsg = FALSE;
- while (argc >= 2) {
- argc--;
- if (strCmpU(argv[argc], "+netlog") == SAMESTRING)
- logNetResults = TRUE;
- else
- if (strCmpU(argv[argc], "+interrupts") == SAMESTRING) {
- IBMinterrupts = TRUE;
- printf("Interrupts on\n");
- }
- else
- errMsg = TRUE;
- }
- initCitadel();
- greeting();
-
- if (errMsg) {
- sPrintf(msgBuf.mbtext,
- "System brought up from apparent crash. See header for time it came up.");
- aideMessage(FALSE);
- }
-
- logMessage(FIRST_IN, "", FALSE);
-
- while (!ExitToMsdos) {
- x = getCommand(&c);
-
- outFlag = OUTOK;
-
- if ((c==CNTRLl) ? doSysop(0, '\0') : doRegular(x, c)) {
- if (!expert) mPrintf(" ? (Type '?' for menu)\n \n" );
- else mPrintf(" ?\n \n" );
- }
- }
- if (loggedIn) terminate( /* hangUp == */ TRUE);
- logMessage(LAST_OUT, "", FALSE);
- writeSysTab();
- modemClose();
- exit(exitValue);
- }
-